package com.itheima.dao;

import com.itheima.pojo.Menu;
import com.itheima.pojo.Role;
import com.itheima.pojo.User;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Set;

public interface MenuDao {
    @Select("select * from t_user where username = #{user}")
    User findByusername(String username);

    @Select("select * from t_user_role ur ,t_role r where ur.user_id = #{id} and ur.role_id = r.id")
    Set<Role> findAll(Integer id);

    @Select("select * from t_menu m,t_role_menu rm where m.id = rm.menu_id and rm.role_id = #{id}")
    List<Menu> findByMenu(Integer id);

    @Select("select * from t_menu where parentMenuId = #{id}")
    List<Menu> findByMid(Integer id);

    @Select("select * from t_menu")
    List<Menu> selectAll();
}
